package com.vchello.service.impl.agency;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.vchello.dao.agency.AgencyDao;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.vchello.bean.agency.Agency;
import com.vchello.service.agency.AgencyService;

/**
 * 
 * @author power
 *
 */
@Service(value = "agencyService")
public class AgencyServiceImpl extends ServiceImpl<AgencyDao, Agency> implements AgencyService {

	@Autowired
	private AgencyDao agencyDao;

	@Override
	public List<Agency> findAgencyUser(Page<Agency> page, Agency agency) {
		Wrapper<Agency> wrapper = new EntityWrapper<Agency>();
		return agencyDao.selectPage(page, wrapper);
	}

	@Override
	public Integer saveAgency(Agency agency) {
		return agencyDao.insert(agency);
	}

	@Override
	public Page<Agency> findAgencyApply(Page<Agency> page, Agency agency) {
		Wrapper<Agency> wrapper = new EntityWrapper<Agency>();
		return selectPage(page, wrapper);
	}

	@Override
	public Agency findAgencyById(int id) {
		return agencyDao.selectById(id);
	}

	@Override
	public Integer updateAgency(Agency agency) {
		return agencyDao.updateById(agency);
	}

}
